Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: support rabbitmq headers #997

Merged
merged 7 commits into from
Sep 28, 2024
Merged

Conversation

DaAlbrecht
Copy link
Contributor

@DaAlbrecht DaAlbrecht commented Sep 25, 2024

Purpose

This pull request adds the ability to include custom headers in RabbitMQ message properties. It introduces support for the headers field in BasicProperties and updates the Java code to map these headers during message publishing

Examples

import ballerinax/rabbitmq;

rabbitmq:ConnectionConfiguration config = {
    username: "guest",
    password: "guest"
};
rabbitmq:Client rabbitmqClient = check new ("localhost", 5672, config);

public function main() returns error? {
    map<anydata> headers = {"header1": "value1", "header2": "value2"};
    rabbitmq:BasicProperties basicProperties = {headers: headers};
    rabbitmq:AnydataMessage anydataMessage = {routingKey: "test", content: "hello world", properties: basicProperties};
    check rabbitmqClient->publishMessage(anydataMessage);
}

Checklist

  • Linked to an issue
  • Updated the changelog
  • Added tests
  • Updated the spec
  • Checked native-image compatibility

@CLAassistant
Copy link

CLAassistant commented Sep 25, 2024

CLA assistant check
All committers have signed the CLA.

@aashikam
Copy link
Contributor

aashikam commented Sep 26, 2024

Hi @DaAlbrecht ,
LGTM
Could you try to add a test for this?

Build failure: The existing tests seems to have failed? Did you try building this locally?

@DaAlbrecht
Copy link
Contributor Author

Hi @aashikam

The tests didn't pass because I haven't added support for consuming messages and the corresponding headers. Fixed this now and added a new test.

@tharindu-nw
Copy link

Some compiler plugin tests seem to be failing still

@aashikam
Copy link
Contributor

aashikam commented Sep 27, 2024

Screenshot 2024-09-27 at 21 28 29

I inspected the error. This comes for the following files but they have correctly used the rabbitmq:AnydataMessage record.
Screenshot 2024-09-27 at 21 31 49

And the PR does not include any compiler plugin related changes.

Fix

Added the fix here DaAlbrecht#1
@DaAlbrecht please merge, or you can add these changes to your PR by yourself. This fixes the compiler plugin test failure.

@DaAlbrecht
Copy link
Contributor Author

Thank you for the fix! @aashikam merged your pr

aashikam
aashikam previously approved these changes Sep 27, 2024
Copy link
Contributor

@aashikam aashikam left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@aashikam aashikam merged commit 8de41e6 into ballerina-platform:master Sep 28, 2024
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants